package com.hnevc.yourhealthmanager.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnevc.yourhealthmanager.entity.HealthUser;
import com.hnevc.yourhealthmanager.dao.HealthUserMapper;
import com.hnevc.yourhealthmanager.service.HealthUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HealthUserServiceImpl extends ServiceImpl<HealthUserMapper, HealthUser> implements HealthUserService {
    @Autowired
    HealthUserMapper healthUserMapper;
    @Override
    public HealthUser login(String username, String password) {
        return healthUserMapper.selectUserByUserPhoneAndPassword(username,password);

    }

    @Override
    public HealthUser login2(String userPhone, String password) {
        return healthUserMapper.selectUserByUserPhoneAndPassword(userPhone,password);
    }

    @Override
    public HealthUser updateHeadPic(Integer id, String s) {
        HealthUser healthUser= healthUserMapper.selectById(id);
        healthUser.setIcon(s);
        if(healthUserMapper.updateById(healthUser)>0){
            return healthUser;
        }else{
            return null;
        }
    }
}
